package com.example.demo.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Atanycosts
 * @description 针对表【user(用户)】的数据库操作Mapper
 * @createDate 2023-03-06 15:52:59
 * @Entity demo.entity.User
 */
@Mapper
// @Repository
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据id查询用户信息
     *
     * @param id
     * @return
     */

    @Select("select * from user where id =#{id}")
    User getUserInfo(Long id);

    /**
     * 新增用户
     *
     * @param user
     * @return
     */
    int save(User user);

    /**
     * 更新用户信息
     *
     * @param user
     * @return
     */
    int update(User user);

    /**
     * 根据id删除
     *
     * @param id
     * @return
     */
    int deleteById(int id);

    /**
     * 查询所有用户信息
     *
     * @return
     */
    @Select("select * from user")
    List<User> selectAll();

}




